wrote:
I am using VB6+ADO+ODBC with pgSQL.
I need to obtain the value of a serial field
(autogenerated) inmediatly after I do a INSERT query. How can I do?
--=20
--------
Timothy Reed
=09
tareed@gmail.com
=09
------------------------------------------------------------ -------
This email and any attachments transmitted with it are confidential (and po=
tentially legally privileged) and intended solely for the use of the indivi=
dual or entity to whom they are addressed. If you have received this email =
in error please notify the sender and do not store, copy or disclose the co=
ntent to any other person.
It is the responsibility of the recipient to ensure that opening this messa=
ge and/or any of its attachments will not adversely affect its systems. No =
responsibility is accepted by the sender.
------------------------------------------------------------ -------
------_=_NextPart_001_01C62CBE.7E66134D
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Message
0ff>
size=3D2>Try using SELECT
N=20
class=3D293154214-08022006>currval('sequenc_name');
ONT>
size=3D2>
ze=3D2>From=20
the docs:
size=3D2>
Return the value most recently obtain=
ed by=20
nextval
for this sequence in the current sess=
ion.=20
(An error is reported if nextval
has never be=
en=20
called for this sequence in this session.) Notice that because this is retu=
rning=20
a session-local value, it gives a predictable answer whether or not other=
=20
sessions have executed nextval
since the curr=
ent=20
session did.
022006>This=20
should be much faster than SELECT max(... and transaction=20
safe.
size=3D2>Regards,
Ben
style=3D"PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px soli=
d; MARGIN-RIGHT: 0px">
You should try SELECT MAX( <fieldname> ) =
FROM=20
<tablename>; ??
On 2/8/06, Sis=
temas=20
C.M.P. <
href=3D"mailto:sistemascmp@redynet4.com.ar">sistemascmp@redy net4.com.ar <=
/A>>=20
wrote:
style=3D"PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(2=
04,204,204) 1px solid">
I am using VB6+ADO+ODBC with=20
pgSQL.
I need to obtain the value of a serial=
field=20
(autogenerated) inmediatly after I do a INSERT query. How can I=
=20
do?
--=20
--------
Timothy Reed
href=3D"mailto:tareed@gmail.com">tareed@gmail.com
-------------------=
------------------------------------------------
This email and any =
attachments transmitted with it are confidential (and potentially legally p=
rivileged) and intended solely for the use of the individual or entity to w=
hom they are addressed. If you have received this email in error please not=
ify the sender and do not store, copy or disclose the content to any other =
person.
It is the responsib=
ility of the recipient to ensure that opening this message and/or any of it=
s attachments will not adversely affect its systems. No responsibility is a=
ccepted by the sender.
-------------------=
------------------------------------------------
=
BODY>
------_=_NextPart_001_01C62CBE.7E66134D--